import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'login',
    component: () => import('@/views/Login')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/Home'),
    children: [
      {
        path: '/home',
        name: 'default',
        meta: { title: '用户' },
        component: () => import('@/views/Admin/HomeDefault'),
      },
      {
        path: '/module1',
        name: 'module1',
        meta: { title: '模块一' },
        component: () => import('@/views/Admin/ModuleOne'),
      },
      {
        path: '/module2',
        name: 'module2',
        meta: { title: '模块二' },
        component: () => import('@/views/Admin/ModuleTwo'),
      },
      {
        path: '/user',
        name: 'user',
        meta: { title: '管理' },
        component: () => import('@/views/Admin/UserManage'),
      },
    ]
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
